1. Field of the Invention
This invention is related to the field of processors and, more particularly, to system call instructions in processor architectures.
2. Description of the Related Art
The x86 architecture (also known as the IA-32 architecture) has enjoyed widespread acceptance and success in the marketplace. Accordingly, it is advantageous to design processors according to the x86 architecture. Such processors may benefit from the large body of software written to the x86 architecture (since such processors may execute the software and thus computer systems employing the processors may enjoy increased acceptance in the market due to the large amount of available software).
The x86 architecture supports a set of four privilege levels at which operating system and/or application code may execute. Application code typically executes at the lowest privilege level (3), and at least some of the operating system code typically executes at the highest privilege level (0). Changes in privilege level are accomplished using a relatively slow gate mechanism within the segmentation mechanism of the x86 architecture. In the gate mechanism, low privileged code (e.g. application code) may transfer control to higher privileged code through a gate descriptor in the segment descriptor table (which may be located by arguments to the CALL instruction supported in the x86 architecture) which includes protection checking to ensure the privilege transition is allowed and which points to yet another segment descriptor which locates the higher privileged code. Numerous protection checks are performed during the transition.
Unfortunately, the gate mechanism is too slow to allow for efficient calls to operating system services, reducing the execution performance of the system. To address this problem, Advanced Micro Devices, Inc. introduced two instructions, a system call (SYSCALL) instruction and a system return (SYSRET) instruction. These instructions allow for a low latency call to the operating system and return from the operating system which bypasses numerous protection checks and memory accesses to the descriptor tables. Intel Corp. also introduced SYSENTER and SYSEXIT instructions for similar reasons. The system call instruction branches to the operating system at an address specified in a register (e.g. a model specific register).
As computer systems have continued to evolve, 64 bit address size (and sometimes operand size) has become desirable. A larger address size allows for programs having a larger memory footprint (the amount of memory occupied by the instructions in the program and the data operated upon by the program) to operate within the memory space. A larger operand size allows for operating upon larger operands, or for more precision in operands. More powerful applications and/or operating systems may be possible using 64 bit address and/or operand sizes. Thus, it may be desirable to provide an architecture which is compatible with the x86 processor architecture but which includes support for 64 bit processing as well.
Supporting 64 bit processing may complicate operating system calls and returns. Generally, the application program may load operands into registers, predefined memory locations, and/or the stack prior to performing the system call instruction. The operands may specify the desired operating system service as well as operands for that service. Unfortunately, the size of the operands may depend on the operating mode in which the application program is executing (e.g. 32 bit applications may provide 32 bit operands and 64 bit applications may provide 64 bit operands). Thus, the location of each operand (e.g. in memory or on the stack) may depend on the operating mode of the application program. Furthermore, the operands in registers may require modification (e.g. sign extension) before being used if the application program is 32 bit. It may not be easy to quickly determine the operating mode of the application program.